﻿@using CodeGenerator.Core
@using System.Text
@{
    int count = 0;
    string primaryKey = "";
    TableInfo table = Model.TableInfo;
}
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Model" namespace="Shengyi.Model.Domain">
    @{
        @:<class name="@(CodeGenerator.Common.Utils.Pascal(Model.Name))Model" table="@(table.Name)" dynamic-update="true">
    if (table.ColumnList.Count > 0)
        {
            foreach (ColumnInfo column in table.ColumnList)
            {
                if (column.IsPrimaryKey=="是")
                {
                @:<id name="@column.Name" type="@column.NetType.Alias">
                    @:<column name="@column.Name" not-null="true" />
                    @:<generator class="assigned" />
                @:</id>
                }
                else
                {
                    @:<property name="@column.Name" type="@column.NetType.Alias" not-null="@(column.AllowDBNull=="是"?"false":"true")" />
                }
            }
        }
@:</class>
    }
</hibernate-mapping> 